<?php

require_once(TANGRA_MAIN_DIR.'nls/date.inc.php');


class RSS_Channel extends Tangra_Class {
	private $id;
	private $title;
	private $link;
	private $description;
	private $language = 'en-us';
	private $copyright;
	private $managing_editor;
	private $web_master;
	private $pub_date;
	private $last_build_date;
	private $ttl = 60;
	private $disabled = false;


	public function set_id($id) {
		tangra_if_not_int_throw_e($id);

		$this->id = $id;
	}


	public function get_id() {
		return $this->id;
	}


	public function set_title($title) {
		$this->title = $title;
	}


	public function get_title() {
		return $this->title;
	}


	public function set_link($link) {
		$this->link = $link;
	}


	public function get_link() {
		return $this->link;
	}


	public function set_description($description) {
		$this->description = $description;
	}


	public function get_description() {
		return $this->description;
	}


	public function set_language($language) {
		$this->language = $language;
	}


	public function get_language() {
		return $this->language;
	}


	public function set_copyright($copyright) {
		$this->copyright = $copyright;
	}


	public function get_copyright() {
		return $this->copyright;
	}


	public function set_managing_editor($managing_editor) {
		$this->managing_editor = $managing_editor;
	}


	public function get_managing_editor() {
		return $this->managing_editor;
	}


	public function set_web_master($web_master) {
		$this->web_master = $web_master;
	}


	public function get_web_master() {
		return $this->web_master;
	}


	public function set_pub_date($pub_datetime) {
		if (check_timestamp($pub_date)) {
			$this->pub_date = $pub_date;
		} else {
			throw new Tangra_Module_Exception('Invalid date:'.$pub_date);
		}
	}


	public function get_pub_date() {
		return $this->pub_date;
	}


	public function get_pub_date_822() {
		$timestamp = datetime_to_timestamp($this->pub_date);
		$gmt_mtime = gmdate('D, d M Y H:i:s', $timestamp) . ' GMT';

		return $gmt_mtime;
	}


	public function set_last_build_date($last_build_date) {
		if (check_timestamp($last_build_date)) {
			$this->last_build_date = $last_build_date;
		} else {
			throw new Tangra_Module_Exception('Invalid date:'.$last_build_date);
		}
	}


	public function get_last_build_date() {
		return $this->last_build_date;
	}


	public function get_last_build_date_822() {
		$timestamp = datetime_to_timestamp($this->last_build_date);
		$gmt_mtime = gmdate('D, d M Y H:i:s', $timestamp) . ' GMT';

		return $gmt_mtime;
	}


	public function set_ttl($ttl) {
		tangra_if_not_int_throw_e($ttl);

		$this->ttl = $ttl;
	}


	public function get_ttl() {
		return $this->ttl;
	}


	public function set_disabled($disabled) {
		$this->disabled = $disabled ? true : false;
	}


	public function get_disabled() {
		return $this->disabled;
	}
}